package com.woniuxy.factory.controller;

import com.woniuxy.factory.entity.Emp;
import com.woniuxy.factory.entity.ResponseResult;
import com.woniuxy.factory.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @NTLX data 2020 08 19
 */
@Controller
public class EmpController {

    @Autowired
    EmpService empService;

    @RequestMapping("/emp/selectEmp.do")
    @ResponseBody
    public ResponseResult selectEmp(Emp emp,String depName){
        ResponseResult result = new ResponseResult();
        List list;
        if(depName!="" && depName!=null){
            list = empService.selectEmp(emp,depName);
        }else {
            emp.setDep(null);
            list = empService.selectEmp(emp);
        }
        result.setCode(0);
        result.setData(list);
        return result;
    }
//
//    @RequestMapping("/emp/selectSinpleEmp.do")
//    @ResponseBody
//    public ResponseResult selectSinpleEmp(Emp emp){
//        ResponseResult result = new ResponseResult();
//        List list = empService.selectSinpleEmp(emp);
//        result.setCode(0);
//        result.setData(list);
//        return result;
//    }
    @ResponseBody
    @RequestMapping("/emp/getempsBynum")
    public ResponseResult getEmps(Emp emp){
        return  empService.getEmps(emp);

    }
}
